package com.zgq.share.db;

import com.zgq.share.entity.ShareBean;

import android.content.Context;

public class ShareInfoMananger {
	
	private ShareInfoDao dao;
	
	public ShareInfoMananger(Context context) {
		super();
		dao = new ShareInfoDao(context);
	}
	
	public long addShareInfo(ShareBean share) {
		long id;
		
		try {
			dao.open();
			
			id = dao.addShareInfo(share);
		} finally {
			dao.close();
		}
		
		return id;
	}
	
	public ShareBean getShareInfo(String name) {
		ShareBean share = null;
		
		try {
			dao.open();
			
			share = dao.getShareSetting(name);
		} finally {
			dao.close();
		}
		
		return share;
	}
	
	public boolean deleteShareInfo(String name) {
		boolean res = false;
		
		try {
			dao.open();
			
			res = dao.delete(name);
		} finally {
			dao.close();
		}
		
		return res;
	}

}
